<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>后台登录</title>
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta http-equiv="Cache-Control" content="no-siteapp"/>
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
	<link rel="stylesheet" href="/static/plugins/layui/css/layui.css" media="all"/>
	<link rel="stylesheet" href="/static/plugins/login/css/style.css"/>
</head>

<body class="body_bj">
<div class="login">
	<form action="" class="layui-form" method="post">
		<div class="logo">
			<img src="/static/plugins/login/img/logo.png" alt="">
		</div>
		<ul class="login-list">
			<li>
				<input type="text" name="userName" lay-verify="userName" autocomplete="off" placeholder="这里输入登录名">
			</li>
			<li>
				<input type="password" name="userPwd" lay-verify="userPwd" autocomplete="off" placeholder="这里输入密码">
			</li>

			<li>
				记住帐号<input type="checkbox" name="rememberMe" value="true" lay-skin="switch" checked title="记住帐号">
			</li>
			<li><a class="btn" lay-submit lay-filter="login">登录</a></li>
		</ul>
	</form>
</div>

<script type="text/javascript" src="/static/plugins/layui/layui.js"></script>
<script type="text/javascript">
	layui.use(['layer', 'form'], function () {
		var layer = layui.layer,
			$ = layui.jquery,
			form = layui.form();

		form.on('submit(login)', function (data) {
			var loading = layer.load();
			$.ajax({
				type: "POST",
				url: '/auth/login',
				data: data.field,
				complete: function () {
					layer.close(loading);
				},
				success: function (result) {
					if (result.success) {
						setTimeout(function () {
							window.location.href = '/index.html';
						}, 500);
					} else {
						layer.msg(result.msg, {icon: 2});
					}
				}
			});
			return false;
		});
	});
</script>
</body>
</html>